<#import "/ftl/pager.ftl" as pager/>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title><@spring.message "module.common.html.title"/></title>
<#include "/resources.html">
<script>
function doDelete(id){
	var setting = {hint:"<@spring.message 'module.dashboard.message.delete.hint'/>",onConfirm:function(){
                  showProcess("<@spring.message 'module.common.delete.loading'/>");
                  $.post("/dashboard/message/delete.action", {id:id},function(data){
				      hideProcess();
				      showSTip("<@spring.message 'module.common.delete.success'/>");
				      $('#'+id).fadeOut().fadeIn().fadeOut();
				      doHideConfirm();
			      });
		                     
	}};
	
doShowConfirm(setting);
}
</script>
</head>
<body class="web-app ui-selectable">


<#include "/dashboard/header.html">
      <#include "/dashboard/nav.html">

<div id="mainWrapper">
	<div class="lay-main-toolbar"></div>
	<div>
		<form action="/dashboard/message/list.action" method="post" id="searchForm" >
		<input type="hidden" name="currentPage" id="currentPage" value="0"/>
		<table width="100%" class="utable">
			<thead>
				<tr class="tableHeader">
				    <th width="12%"><@spring.message "module.common.id"/></th>
					<th width="8%"><@spring.message "module.dashboard.message.sender"/></th>
					<th width="8%"><@spring.message "module.dashboard.message.receiver"/></th>
					<th width="8%"><@spring.message "module.common.type"/></th>
					<th width="7%"><@spring.message "module.dashboard.message.format"/></th>
					<th width="6%"><@spring.message "module.common.state"/></th>
					<th width="33%"><@spring.message "module.common.content"/></th>
					<th width="8%"><@spring.message "module.common.time"/></th>
					<th width="10%"><@spring.message "module.common.operation"/></th>
				</tr>
			 	<tr>
                    <td></td>
					<td style="padding: 2px;">
						<input name="sender" value="${message.sender! }" type="text" class="form-control" style="width: 100%;" />
					</td>

					<td>
						<input name="receiver" type="text" value="${message.receiver! }" class="form-control" style="width: 100%; " />
					</td>
					<td>
						<input name="action" type="text" value="${message.action! }" class="form-control" style="width: 100%; " />
					</td>
					<td>
						<input name="format" type="text" value="${message.format! }" class="form-control" style="width: 100%; " />
					</td>
					<td>
						 <select name="state" id="mstatus" class="form-control" style="width: 100%;padding：6px;">
						 <option />
						 <option value="2" <#if '2' == message.state! > selected="selected"</#if>><@spring.message "module.dashboard.message.state.read"/></option>
						 <option value="1" <#if '1' == message.state! > selected="selected"</#if>><@spring.message "module.dashboard.message.state.received"/></option>
						 <option value="0" <#if '0' == message.state! > selected="selected"</#if>><@spring.message "module.dashboard.message.state.unreceived"/></option>
						 </select>
					</td>
					<td></td>
					<td></td>
					<td>
						<button type="submit" class="btn btn-primary btn-sm">
							<span class="glyphicon glyphicon-search"></span><@spring.message "module.common.query"/>
						</button>
					</td>
				</tr>
			</thead>
			<tbody>
            	<#list page.content as message>
					<tr id="${message.id?c}"  style=" height: 50px;">
						<td>${message.id?c}</td>
						<td>${message.sender! }</td>
						<td>${message.receiver! }</td>
						<td>${message.action! }</td>
						<td>${message.format! }</td>
						<td>
						    <#if message.state! == '2'><@spring.message "module.dashboard.message.state.read"/></#if>
						    <#if message.state! == '1'><@spring.message "module.dashboard.message.state.received"/></#if>
							<#if message.state! == '0'><@spring.message "module.dashboard.message.state.unreceived"/></#if>
						</td>
						<td>${message.content!?html}</td>
					    <td>${message.timestamp?number_to_datetime}</td>
						<td>
						 	<div class="btn-group btn-group-xs">
								<button type="button" class="btn btn-danger"  style="padding: 5px;"  onclick="doDelete('${message.id?c}')">
									<span class="glyphicon glyphicon-trash"></span><@spring.message "module.common.delete"/>
								</button>
						    </div>
						</td>
					</tr>
				</#list>
				 
			</tbody>
			<tfoot>
				<tr>
				    <td colspan="9"><@pager.pager page=page/></td>
				</tr>
			</tfoot>
		</table>
	</form>

</div>
</div>

<script>
	$('#messageMenu').addClass('current');
</script>
</body>
</html>
